<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/WEB-INF/templates/BasicTemplate.xhtml">

	<ui:define name="content">

		<f:event type="preRenderView"
			listener="#{recruiterController.beforeSearchRecruiter}" />

		<div class="title ui-widget-header ui-corner-all">
			<h:panelGrid style="margin:auto;">
		BUSCAR RECLUTADORES
		</h:panelGrid>

		</div>

		<h:form id="formSearch">
			<h:panelGrid style="margin:auto;">
				<h:panelGrid style="margin:auto;text-align:center;">
					<p:messages id="messages"></p:messages>
				</h:panelGrid>


				<h:panelGrid columns="6">
					<p:outputLabel value="Area"></p:outputLabel>
					<p:selectOneMenu id="areas" required="true"
						requiredMessage="Debe seleccionar area"
						value="#{recruiterController.areaSelected}">
						<f:selectItem itemValue="" itemLabel="Seleccione..."></f:selectItem>
						<f:selectItem itemValue="t" itemLabel="Todos"></f:selectItem>
						<f:selectItem itemValue="s" itemLabel="Sin Area"></f:selectItem>
						<f:selectItems value="#{recruiterController.areas}"></f:selectItems>
					</p:selectOneMenu>

					<p:outputLabel value="DNI"></p:outputLabel>
					<p:inputText style="width: 120px;"
						value="#{recruiterController.documentNumber}"></p:inputText>

					<p:outputLabel value="Nombres"></p:outputLabel>
					<p:inputText style="width: 230px;"
						value="#{recruiterController.name}"></p:inputText>



				</h:panelGrid>
				<h:panelGrid style="margin:auto;text-align:center;">
					<p:commandButton icon="ui-icon-search"
						actionListener="#{recruiterController.searchRecruiter}"
						value="Buscar" process="@form"
						update=":formSearch:searchTable :formSearch:messages">
					</p:commandButton>
				</h:panelGrid>
			</h:panelGrid>


			<p:dataTable value="#{recruiterController.recruiters}" var="r"
				rowKey="#{r.id}" paginator="true" rows="10" id="searchTable"
				selectionMode="single">

				<p:column headerText="DNI">
					<h:outputText value="#{r.documentNumber}"></h:outputText>
				</p:column>

				<p:column headerText="NOMBRES">
					<h:outputText value="#{r.firstname}"></h:outputText>
				</p:column>

				<p:column headerText="APELLIDOS">
					<h:outputText value="#{r.lastname}"></h:outputText>
				</p:column>

				<p:column headerText="AREAS">
					<h:outputText value="#{r.areasList}"></h:outputText>
				</p:column>

				<p:column style="width:4%">
					<p:commandButton id="selectButton" action="edit_recruiter.xhtml"
						icon="ui-icon-pencil" value="Editar" update=":formSearch:messages">
						<f:param name="recruiterId" value="#{r.id}"></f:param>
					</p:commandButton>
				</p:column>


			</p:dataTable>


		</h:form>
	</ui:define>

</ui:composition>
</html>
